package cn.stylefeng.guns.modular.gridsystem.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import cn.stylefeng.guns.modular.gridsystem.model.param.BizCollectionSampleManageParam;
import cn.stylefeng.guns.modular.gridsystem.service.BizCollectionSampleManageService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 采集端样本管理 控制器
 *
 * @author: ssy
 * @date: 2022/08/03 09:17
 */
@RestController
@RequiredArgsConstructor
public class BizCollectionSampleManageController {

    private final BizCollectionSampleManageService sampleManageService;

    /**
     * 分页查询采集端样本管理
     *
     * @author ssy
     * @date 2022/02/16 10:59
     */
    @GetMapping("/bizCollectionSampleManage/page")
    @BusinessLog(title = "采集端样本管理_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(BizCollectionSampleManageParam param) {
        return new SuccessResponseData(sampleManageService.page(param));
    }

    /**
     * 分页查询采集端网关通道样本
     *
     * @author zxw 2022-12-10 08:05
     */
    @GetMapping("/bizCollectionSampleManage/pageList")
    @BusinessLog(title = "分页查询采集端网关通道样本", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData pageList(BizCollectionSampleManageParam param) {
        return new SuccessResponseData(sampleManageService.pageList(param));
    }

    /**
     * 获取全部采集端样本管理
     *
     * @author ssy
     * @date 2022/02/16 10:59
     */
    @GetMapping("/bizCollectionSampleManage/list")
    @BusinessLog(title = "采集端样本管理_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list() {
        return new SuccessResponseData(sampleManageService.list());
    }

    /**
     * 查看详情采集端样本管理
     *
     * @author ssy
     * @date 2022/02/16 10:59
     */
    @GetMapping("/bizCollectionSampleManage/detail")
    @BusinessLog(title = "采集端样本管理_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(BizCollectionSampleManageParam param) {
        return new SuccessResponseData(sampleManageService.detail(param));
    }


    /**
     * 删除采集端样本管理
     *
     * @author ssy
     * @date 2022/02/16 10:59
     */
    @PostMapping("/bizCollectionSampleManage/delete")
    @BusinessLog(title = "采集端样本管理_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody BizCollectionSampleManageParam param) {
        sampleManageService.delete(param);
        return new SuccessResponseData();
    }

    /**
     * 注册故障模型
     *
     * @author ssy
     * @date 2022/02/16 10:59
     */
    @PostMapping("/bizCollectionSampleManage/registerModel")
    @BusinessLog(title = "注册故障模型", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData registerModel(@RequestBody @Validated(BizCollectionSampleManageParam.registerModel.class) BizCollectionSampleManageParam param) {
        return new SuccessResponseData(sampleManageService.registerModel(param));
    }

    /**
     * 注册正样本
     *
     * @author zxw 2022-11-25 11:55
     */
    @PostMapping("/bizCollectionSampleManage/registerNormalModel")
    @BusinessLog(title = "注册正样本", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData registerNormalModel(@RequestBody BizCollectionSampleManageParam param) {
        return new SuccessResponseData(sampleManageService.registerNormalModel(param));
    }

    /**
     * 查询远程任务响应
     *
     * @author zxw 2022-12-07 13:38
     */
    @GetMapping("/bizCollectionSampleManage/queryTask")
    @BusinessLog(title = "查询远程任务响应", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData queryTask(BizCollectionSampleManageParam param) {
        return new SuccessResponseData(sampleManageService.queryTask(param));
    }

}
